package com.nice.nice201110.controller;

import com.nice.nice201110.service.TbaseSelectService;
import com.nice.nice201110.utils.NiceEnum;
import com.nice.nice201110.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;
/**
 *  获取 select all
 * */
@RestController
@RequestMapping("/admin/select")
public class SelectComtroller {

    @Autowired
    TbaseSelectService tbaseSelectService;

    private Map<String,Object> codeMes = new HashMap<>();

    @RequestMapping(method = RequestMethod.GET,value = "/capitalStatus")
    public Map<String,Object> getList1(HttpServletRequest request,@RequestParam(name = "isdelete",required=true) Integer isdelete){
        HttpSession session = request.getSession();
        UserVo userVo = (UserVo)session.getAttribute("USER");
        if(userVo==null){
            codeMes.put("code", NiceEnum.code_300);
            codeMes.put("message",NiceEnum.NiceMap.get(NiceEnum.code_300));
            return codeMes;
        }
        codeMes.put("code", NiceEnum.code_200);
        codeMes.put("message", NiceEnum.NiceMap.get(NiceEnum.code_200));
        codeMes.put("data", tbaseSelectService.getTBaseCapitalStatus(isdelete));
        return codeMes;
    }
    @RequestMapping(method = RequestMethod.GET,value = "/capitalAll")
    public Map<String,Object> getList2(HttpServletRequest request){
        HttpSession session = request.getSession();
        UserVo userVo = (UserVo)session.getAttribute("USER");
        if(userVo==null){
            codeMes.put("code", NiceEnum.code_300);
            codeMes.put("message",NiceEnum.NiceMap.get(NiceEnum.code_300));
            return codeMes;
        }
        codeMes.put("code", NiceEnum.code_200);
        codeMes.put("message", NiceEnum.NiceMap.get(NiceEnum.code_200));
        codeMes.put("data", tbaseSelectService.getTBaseCapitalList());
        return codeMes;
    }
    @RequestMapping(method = RequestMethod.GET,value = "/diseaseStatus")
    public Map<String,Object> getList3(HttpServletRequest request,@RequestParam(name = "isdelete",required=true) Integer isdelete){
        HttpSession session = request.getSession();
        UserVo userVo = (UserVo)session.getAttribute("USER");
        if(userVo==null){
            codeMes.put("code", NiceEnum.code_300);
            codeMes.put("message",NiceEnum.NiceMap.get(NiceEnum.code_300));
            return codeMes;
        }
        codeMes.put("code", NiceEnum.code_200);
        codeMes.put("message", NiceEnum.NiceMap.get(NiceEnum.code_200));
        codeMes.put("data", tbaseSelectService.getTBaseDiseaseStatus(isdelete));
        return codeMes;
    }
    @RequestMapping(method = RequestMethod.GET,value = "/diseaseAll")
    public Map<String,Object> getList4(HttpServletRequest request){
        HttpSession session = request.getSession();
        UserVo userVo = (UserVo)session.getAttribute("USER");
        if(userVo==null){
            codeMes.put("code", NiceEnum.code_300);
            codeMes.put("message",NiceEnum.NiceMap.get(NiceEnum.code_300));
            return codeMes;
        }
        codeMes.put("code", NiceEnum.code_200);
        codeMes.put("message", NiceEnum.NiceMap.get(NiceEnum.code_200));
        codeMes.put("data", tbaseSelectService.getTBaseDiseaseList());
        return codeMes;
    }

    @RequestMapping(method = RequestMethod.GET,value = "/raceStatus")
    public Map<String,Object> getList5(HttpServletRequest request,@RequestParam(name = "isdelete",required=true) Integer isdelete){
        HttpSession session = request.getSession();
        UserVo userVo = (UserVo)session.getAttribute("USER");
        if(userVo==null){
            codeMes.put("code", NiceEnum.code_300);
            codeMes.put("message",NiceEnum.NiceMap.get(NiceEnum.code_300));
            return codeMes;
        }
        codeMes.put("code", NiceEnum.code_200);
        codeMes.put("message", NiceEnum.NiceMap.get(NiceEnum.code_200));
        codeMes.put("data", tbaseSelectService.getTBaseRaceStatus(isdelete));
        return codeMes;
    }
    @RequestMapping(method = RequestMethod.GET,value = "/raceAll")
    public Map<String,Object> getList6(HttpServletRequest request){
        HttpSession session = request.getSession();
        UserVo userVo = (UserVo)session.getAttribute("USER");
        if(userVo==null){
            codeMes.put("code", NiceEnum.code_300);
            codeMes.put("message",NiceEnum.NiceMap.get(NiceEnum.code_300));
            return codeMes;
        }
        codeMes.put("code", NiceEnum.code_200);
        codeMes.put("message", NiceEnum.NiceMap.get(NiceEnum.code_200));
        codeMes.put("data", tbaseSelectService.getTBaseRaceList());
        return codeMes;
    }

    @RequestMapping(method = RequestMethod.GET,value = "/symptomsStatus")
    public Map<String,Object> getList7(HttpServletRequest request,@RequestParam(name = "isdelete",required=true) Integer isdelete){
        HttpSession session = request.getSession();
        UserVo userVo = (UserVo)session.getAttribute("USER");
        if(userVo==null){
            codeMes.put("code", NiceEnum.code_300);
            codeMes.put("message",NiceEnum.NiceMap.get(NiceEnum.code_300));
            return codeMes;
        }
        codeMes.put("code", NiceEnum.code_200);
        codeMes.put("message", NiceEnum.NiceMap.get(NiceEnum.code_200));
        codeMes.put("data", tbaseSelectService.getTBaseSymptomsStatus(isdelete));
        return codeMes;
    }
    @RequestMapping(method = RequestMethod.GET,value = "/symptomsAll")
    public Map<String,Object> getList8(HttpServletRequest request){
        HttpSession session = request.getSession();
        UserVo userVo = (UserVo)session.getAttribute("USER");
        if(userVo==null){
            codeMes.put("code", NiceEnum.code_300);
            codeMes.put("message",NiceEnum.NiceMap.get(NiceEnum.code_300));
            return codeMes;
        }
        codeMes.put("code", NiceEnum.code_200);
        codeMes.put("message", NiceEnum.NiceMap.get(NiceEnum.code_200));
        codeMes.put("data", tbaseSelectService.getTBaseSymptomsList());
        return codeMes;
    }
}
